<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">

<h:head>
    <title>Overview</title>
    <h:outputStylesheet library="css" name="style.css" />
</h:head>

<h:body>
    <f:view locale="#{languageBean.currentLocale}">
        <br />
        <h:outputText value="#{msg.guestbook_overview}" styleClass="h1" />
        <br />
        <br />
        <h:form>
            <h:panelGrid columns="3">
                <h:outputText value="#{msg.guestbook_overview_user}" styleClass="h2" />
                <h:outputText value="#{sessionBean.username}" styleClass="h3" />
                <a4j:mediaOutput element="img" mimeType="image/jpeg" createContent="#{fileUploadBean.paint}"
                                    value="#{row}" style="width:100px; height:100px;" cacheable="false">
                                    <f:param value="#{fileUploadBean.timeStamp}" name="time" />
                </a4j:mediaOutput>
            </h:panelGrid>
            <br />
            <br />
            <h:panelGrid columns="2">
                <h:commandLink action="#{languageBean.changeLocale('de_DE')}">
                    <h:graphicImage library="img" name="german.jpg" />
                </h:commandLink>
                <h:commandLink action="#{languageBean.changeLocale('en')}">
                    <h:graphicImage library="img" name="english.jpg" />
                </h:commandLink>
            </h:panelGrid>
            <rich:dataTable id="guestbookEntries" value="#{guestbookBean.guestbookEntries}" var="entry">
                <f:facet name="noData">#{msg.guestbook_overview_nodata}</f:facet>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{msg.guestbook_overview_name}" />
                    </f:facet>
                    <h:outputText value="#{entry.name}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{msg.guestbook_overview_email}" />
                    </f:facet>
                    <h:outputText value="#{entry.email}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{msg.guestbook_overview_postDate}" />
                    </f:facet>
                    <h:outputText value="#{entry.postDate}">
                        <f:convertDateTime pattern="dd.MM.yyyy HH:mm:ss" timeZone="GMT+1" />
                    </h:outputText>
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{msg.guestbook_overview_title}" />
                    </f:facet>
                    <h:outputText value="#{entry.title}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{msg.guestbook_overview_text}" />
                    </f:facet>
                    <h:outputText value="#{entry.text}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{msg.guestbook_overview_delete}" />
                    </f:facet>
                    <h:commandButton action="#{guestbookBean.delete(entry.id)}" value="#{msg.guestbook_overview_action_deleteButton}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="#{msg.guestbook_overview_edit}" />
                    </f:facet>
                    <h:commandButton action="#{editBean.edit(entry.id)}" value="#{msg.guestbook_overview_action_editButton}" />
                </rich:column>
            </rich:dataTable>
            <br />
            <h:commandButton action="#{logoutBean.logout}" value="#{msg.guestbook_overview_action_logout}" />
        </h:form>
        <h:link value="Create new entry" outcome="guestbookCreateEntry" />
        <br />
        <h:link value="Upload Profile Picture" outcome="guestbookImageUpload" />
    </f:view>
</h:body>

</html>
